package converts

import (
	"gitee.com/captials-team/ubdframe/src/domain/configstc"
	"gorm.io/gorm"
	"gorm.io/gorm/schema"
)

func ConvertGormConfig(c configstc.DBConfig) *gorm.Config {
	return &gorm.Config{
		NamingStrategy: schema.NamingStrategy{
			//定义结构体的TableName方法里无法使用传值进行动态表明设置
			//这里可以做统一的表名前缀
			TablePrefix:         c.TablePrefix,
			SingularTable:       true,
			NameReplacer:        nil,
			NoLowerCase:         false,
			IdentifierMaxLength: 0,
		},
	}
}
